//fmap configuration menu

#include    "set_menu.h"

void set_menu (void)
{
    static int8 enter_hits, tmp11;
    int8    new_val;
    if (cmd_rcv) {
        cmd_rcv=0;
        enter_hits++;
        switch (enter_hits)
        {
        case 1:
            printf("Input X=");
            break;

        case 2:
            X_menu=atoi(rs_string);
            printf("\r%d\r",X_menu);
            printf("Input Y=");
            break;

        case 3:
            Y_menu=atoi(rs_string);
            printf("\r%d\r",Y_menu);
            tmp11=((9*Y_menu)+X_menu);
            //printf("%d", table_read(&fmap,tmp11));
            //printf("Val: %u\r",table_read(&fmap,tmp11));
            printf ("New val=");
            break;

        case 4:
            new_val=atoi(rs_string);
            printf ("\r%d\r",new_val);
#if (0 == PROTEUS_SIM)
            //table_write (&fmap, tmp11, new_val);
#endif
            cmd_rcv=enter_hits=0;
            rs_string[0]='d';
            break;

        default:
            cmd_rcv=enter_hits=0;
            break;
        }
    }
}
int8 table_read (int8 *rom_ptr, int8 offset)
{
    unsigned int8 temp_data;
    rom_ptr+=offset;
    read_program_memory(rom_ptr,&temp_data,1);
    return temp_data;
}

void table_write (int8 *rom_ptr, int8 offset, int8 value)
{
    rom_ptr+=offset;
    write_program_memory(rom_ptr,&value,1);
    return;
}

